package com.talent.core.protocol.mqtt;

import com.talent.core.protocol.mqtt.enums.TlMqttQos;
import com.talent.core.protocol.mqtt.model.entity.TlMessage;
import com.talent.core.protocol.mqtt.model.entity.TlTopic;
import com.talent.core.protocol.mqtt.model.request.TlMqttPublishReq;
import io.netty.channel.ChannelHandlerContext;

import java.util.*;

/**
 * @ClassName：TlMqttSession
 * @Author: hszhou
 * @Date: 2024/11/28 15:40
 * @Description: mqtt的会话
 */
public class TlMqttSession {


    /**客户端标识*/
    private String clientId;
    /**通道*/
    private ChannelHandlerContext ctx;
    private TlMqttQos qos;
    /**需要补发的qos1或qos2的消息 会话保留的时候保存*/
    private Set<TlMqttPublishReq> republish=new HashSet<>();
    /**是否断开清除会话状态*/
    private int cleanSession;
    /**遗嘱消息 在非正常断开后向订阅的主题发送*/
    private TlMessage willMessage;
    /**订阅的主题*/
    private Set<TlTopic> topics =new HashSet<>();

    public TlMqttQos getQos() {
        return qos;
    }

    public void setQos(TlMqttQos qos) {
        this.qos = qos;
    }



    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public ChannelHandlerContext getCtx() {
        return ctx;
    }

    public void setCtx(ChannelHandlerContext ctx) {
        this.ctx = ctx;
    }

    public Set<TlMqttPublishReq> getRepublish() {

        return republish;
    }

    public void setRepublish(Set<TlMqttPublishReq> republish) {
        this.republish = republish;
    }

    public int getCleanSession() {
        return cleanSession;
    }

    public void setCleanSession(int cleanSession) {
        this.cleanSession = cleanSession;
    }

    public TlMessage getWillMessage() {
        return willMessage;
    }

    public void setWillMessage(TlMessage willMessage) {
        this.willMessage = willMessage;
    }

    public Set<TlTopic> getTopics() {

        return topics;
    }

    public void setTopics(Set<TlTopic> topics) {

        this.topics = topics;
    }
}
